import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
  state: () => ({
    userId: localStorage.getItem('userId') || null
  }),
  
  actions: {
    setUserId(userId) {
      this.userId = userId
      localStorage.setItem('userId', userId)
    },
    
    clearUserId() {
      this.userId = null
      localStorage.removeItem('userId')
    },
    
    isLoggedIn() {
      return !!this.userId
    }
  }
}) 